package com.example.commapp.module.login;

import android.widget.EditText;

import com.alibaba.android.arouter.launcher.ARouter;
import com.example.commapp.ActivityContracts;
import com.example.commapp.R;
import com.example.ln.coustomapplication.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Describe:
 * Author: Tenda
 * Time: 2018/12/10  16:21
 * Corpyright (C) 2018-2018 山东六牛科技有限公司
 */
public class LoginActivity extends BaseActivity<LoginPresenter> implements LoginContract.View{
    @BindView(R.id.ed_name)
    EditText edName;
    @BindView(R.id.ed_password)
    EditText edPassword;

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected LoginPresenter initPresenter() {
        return new LoginPresenter();
    }

    @Override
    protected int getActivityLayoutID() {
        return R.layout.activity_login;
    }

    @Override
    public void onLoginSuccess() {
        hideLoading();
        ARouter.getInstance()
                .build(ActivityContracts.MainActivity)
                .navigation();
    }
    @OnClick(R.id.btn_login)
    public void onClick(){
        showLoading();
        mPresenter.onLogin(edName.getText().toString(),edPassword.getText().toString());
    }
}
